package com.itheima.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.function.Consumer;

/*
增强for
 */
public class Demo05 {

    public static void main(String[] args) {
        ArrayList<String> c= new ArrayList<>();
        c.add("坤坤");
        c.add("签签");
        c.add("滔滔");
        c.add("小鹿");
        c.add("小绵羊");


      /*  Iterator<String> iterator = c.iterator();
        while ( iterator.hasNext()) {
            String s = iterator.next();
            System.out.println(s);
            s="zhagnsan";
        }
        System.out.println(c);
        for (String s : c) {
            System.out.println(s);
            s="zhagnsan";
        }
        System.out.println(c);
        for (int i = 0; i < c.size(); i++) {

            String s = c.get(i);
            System.out.println(s);
            s="zhagnsan";
        }
        System.out.println(c);*/
   /*   c.forEach(new Consumer<String>() {
          @Override
          public void accept(String s) {
              System.out.println(s);
          }
      });*/
      c.forEach(s->{});












    }
}
